/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package elevatormanagementsystem;

import java.util.ArrayList;
import java.util.Collections;

/**
 *
 * @author Danny
 */
public class Elevator {
int minFloor;

    public ArrayList getCommands() {
        return commands;
    }

    public void setCommands(ArrayList commands) {
        this.commands = commands;
    }

    public String getDoorStatus() {
        return doorStatus;
    }

    public void setDoorStatus(String doorStatus) {
        this.doorStatus = doorStatus;
    }

    public int getMaxFloor() {
        return maxFloor;
    }

    public void setMaxFloor(int maxFloor) {
        this.maxFloor = maxFloor;
    }

    public int getMinFloor() {
        return minFloor;
    }

    public void setMinFloor(int minFloor) {
        this.minFloor = minFloor;
    }

    public String getMovingDirection() {
        return movingDirection;
    }

    public void setMovingDirection(String movingDirection) {
        this.movingDirection = movingDirection;
    }
int maxFloor;
int currentFloor;
String doorStatus = "closed";

    public int getCurrentFloor() {
        return currentFloor;
    }

    public void setCurrentFloor(int currentFloor) {
        this.currentFloor = currentFloor;
    }
String movingDirection = "stationary";
ArrayList commands;


    public Elevator(int minFloorNumber, int maxFloorNumber) {
        minFloor = minFloorNumber;
        maxFloor = maxFloorNumber;
        currentFloor = minFloorNumber;
        commands = new ArrayList();
    }
    public void addNewCommand(String command)
    {
        if (commands.contains(command)){
        }
        else {
            commands.add(command);
        }
    }
    public void removeCommand(String command) {
        commands.remove(command);
    }
    public String getNextCommand() {
        if (commands.size() != 0) {
        
        return commands.get(0).toString();
        }
        else {
            return "";
    }  
}
   public void sortCommands() {
       if (this.getMovingDirection().equals("waiting")) { 
       }
       else if (this.getMovingDirection().equals("moving up")) {
           Collections.reverse(commands);
       }
       else if (this.getMovingDirection().equals("moving down")) {
           Collections.sort(commands);
       }
       
   }
}

